<!DOCTYPE html>
<html>
<head>
	<title>效能监控</title>
	{{>/WEB-INF/pages/common/refs_base.part.html}}
	{{>/WEB-INF/pages/common/refs_modal.part.html}}
	<link href="{{ctx}}/static/datepicker/datepicker.css" rel="stylesheet" type="text/css" />
<script src="{{ctx}}/static/datepicker/bootstrap-datepicker.js" type="text/javascript"></script>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<style type="text/css">



	
	</style>
	<script type="text/javascript">
	  $(function(){
			$('#datefrom').datepicker({
				format: 'yyyy-mm-dd',
				autoclose: true
			});
		 });
	  
	  function submitForm()
	  {
		  var date=$("#datefrom").val();
		  
		  var reg=/^(19|20)\d\d+-(0[1-9]|1[012])+-(0[1-9]|[12][0-9]|3[01])/
				var result =  reg.exec(date);
				if(result==null)
					{
					alert("日期格式错误");
					return false;
					}
				var url = "/report/show/" + date;
				var dates = date.split("-");
				var newTime = new Date();
				var ThisMomth = newTime.getMonth() + 1;
				var ThisYear = newTime.getFullYear();
				var ThisDay = newTime.getDate();
				var year = dates[0];
				var month = dates[1];
				var day = dates[2];
				if (year > ThisYear)
				{
					alert("不允许查询将来时数据");
					return false;
				}
					if (year==ThisYear && month > ThisMomth)
				{
					alert("不允许查询将来时数据");
					return false;
				}
				if (year==ThisYear && month==ThisMomth && day > ThisDay)
				{
					alert("不允许查询将来时数据");
					return false;
				}
				
				//区分闰年情况
				if (!((1<=month) && (12>=month) && (31>=day) && (1<=day)) )
				{
					alert("日期格式错误!");
					return false;
				}
			
				if (!((year % 4)==0) && (month==2) && (day==29))
				{
					alert("日期格式错误!");
					return false;
				}
				
				if ((month<=7) && ((month % 2)==0) && (day>=31))
				{
					alert("日期格式错误!");
				return false;
				}
				if ((month>=8) && ((month % 2)==1) && (day>=31))
				{
					alert("日期格式错误!");
			     	return false;
				}
				if ((month==2) && (day==30))
				{
					alert("日期格式错误!");
				return false;
				}
			
		  if(date.length<5)
			  {
			  date="today";
			  }
		  var url="{{ctx}}/monitor/show?appId={{appId}}&date="+date;
	      location.href=url;
	  }
	  
	//ecxel导出记录
	function excel()
	{
		$("#dataForm").submit();
	/* 	var url="{{ctx}}/monitor/export";
		 $.ajax({
				type : 'POST',
				url: url,
				dataType:'json',
				data:$("#dataForm").serialize(),
				success: function(json){
				alert(json);
				}
			}); */
	}
	
	
	
	</script>
</head>
<body>
{{>/WEB-INF/pages/common/layout_header.part.html}}
<div class="container">
	<ul class="breadcrumb">
	  <li><a href="{{ctx}}">首页</a></li>
	  <li class="active">效能监控</li>
	</ul>
	{{#message}}
		<div id="message" class="alert alert-success"><button data-dismiss="alert" class="close">×</button>{{message}}</div>
	{{/message}}
	
	
<input maxlength="10"  style="margin-left:400px;" id="datefrom"  type='text' style="width:150px;"  value="{{#user}}{{day}}{{/user}} ">	
<button type="button" class="btn btn-primary" onclick="submitForm()">查找</button>


<div class="btn-group" style="margin-left:400px;">
	
	  <button type="button" class="btn btn-info dropdown-toggle " data-toggle="dropdown">
	    <span >每日效能监控
	    
	    </span>
	    <span class="caret"></span>
	  </button>
	  <ul class="dropdown-menu" role="menu">
	  	
	    <li>
	    	<a href="{{ctx}}/monitor/query?appId={{appId}}&appName={{#user}}{{appName}}{{/user}}&q_LIKE_appName={{identity}}">
	    	监控记录
	    	</a>
	    </li>
	      <li>
	    	<a href="{{ctx}}/plot/plot-index/{{appId}}/DAY">
	    	应用下载统计
	    	</a>
	    </li>
	  </ul>
	
	</div>
	
	<form name="dataForm" id="dataForm" action="{{ctx}}/monitor/show?appId={{appId}}" method="post">
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr>
		<th>用户统计</th><th>每日登陆统计</th><th>每日下载统计</th><th>每日模块活跃度</th><th>记录日期</th>
		</tr></thead>
		<tbody>
			
			<tr>
				<td>
				{{createDate}}
				{{#user}}	
				总用户量:{{methodName}}<br><br>
		   	             今日新增用户:{{className}}<br><br>
		   	            应用用户量：{{version}}<br><br>
			{{/user}}
			</td>	
			<td>
			{{#logins}}	
				
		<a href="{{ctx}}/monitor/query?appName={{appName}}&appId={{appId}}&q_LIKE_action=Login&q_LIKE_appName={{id}}&q_GTE_monitorDate={{#user}}{{day}}{{/user}}+00%3A00%3A00&q_LTE_monitorDate={{#user}}{{day}}{{/user}}+23%3A59%3A59">{{methodName}}:{{className}}</a><br><br>
			{{/logins}}
			{{^logins}}
					<div style="height:40px">该应用暂无人登录</div>
			{{/logins}}
			</td>
				
			<td>
			{{#downloads}}	
		<a href="{{ctx}}/monitor/query?appName={{appName}}&appId={{appId}}&q_LIKE_action=appDownload&q_LIKE_appName={{identity}}&q_LIKE_platformId={{platformId}}&q_EQ_version={{version}}&q_GTE_monitorDate={{#user}}{{day}}{{/user}}+00%3A00%3A00&q_LTE_monitorDate={{#user}}{{day}}{{/user}}+23%3A59%3A59">{{version}}({{platformId}}):{{className}}</a><br><br>
			{{/downloads}}
			{{^downloads}}
					<div style="height:40px">该应用暂无下载</div>
			{{/downloads}}
			</td>		
				
				<td>
		   {{#modulars}}		
				<a href="{{ctx}}/monitor/query?appName={{appName}}&q_LIKE_appName={{identity}}&appId={{appId}}&q_LIKE_moduleName={{id}}&q_GTE_monitorDate={{#user}}{{day}}{{/user}}+00%3A00%3A00&q_LTE_monitorDate={{#user}}{{day}}{{/user}}+23%3A59%3A59">{{className}}:{{methodName}}</a><br><br>
		   {{/modulars}}

		   	{{^modulars}}
					<div style="height:40px">模块暂无人访问</div>
			{{/modulars}}
		   </td>
				<td>	{{#user}}	
			 <a href="{{ctx}}/monitor/query?appName={{appName}}&q_LIKE_appName={{identity}}&appId={{appId}}&q_GTE_monitorDate={{#user}}{{day}}{{/user}}+00%3A00%3A00&q_LTE_monitorDate={{#user}}{{day}}{{/user}}+23%3A59%3A59">{{day}}</a><br><br>
		   	
			{{/user}}</td>
			</tr> 
	
		</tbody>
		
	</table>
	</form>
	{{#page}}
	{{>/WEB-INF/pages/common/pagination.part.html}}
	{{/page}}
	{{>/WEB-INF/pages/common/layout_footer.part.html}}
</div>	
</body>
</html>
